<template>
  <el-descriptions
      :column="1"
      border
      class="infoTable"
  >

    <el-descriptions-item>
      <template #label>
        <span class="label">申请编号</span>
      </template>
      {{applyItem.applyId}}
    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">申请类型</span>
      </template>
      {{typeString}}
    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">日期</span>
      </template>
      {{applyItem.applyDate}}
    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">学者编号</span>
      </template>
      <el-link :href="authorUrl" target="_blank"> 
        <span class="link">{{applyItem.authorId}}</span>
      </el-link>

    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">学者姓名</span>
      </template>
      <el-link :href="authorUrl" target="_blank">
        <span class="link">{{applyItem.authorName}}</span>
      </el-link>

    </el-descriptions-item>


    <el-descriptions-item>
      <template #label>
        <span class="label">备注说明</span>
      </template>
      {{applyItem.other}}
    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">文献编号</span>
      </template>
      <el-link :href="paperUrl(applyItem.paperId)" target="_blank"> 
        <span class="link">{{applyItem.paperId}}</span>
      </el-link>

    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">文献标题</span>
      </template>
      <el-link :href="paperUrl(applyItem.paperId)" target="_blank"> 
        <span class="link">{{applyItem.title}}</span>
      </el-link>
    </el-descriptions-item>

    <el-descriptions-item>
      <template #label>
        <span class="label">审核状态</span>
      </template>
      <el-tag type="info" v-if="applyItem.isPermitted===null">待审核</el-tag>
      <el-tag type="success" v-else-if="applyItem.isPermitted===true">申请已通过审核</el-tag>
      <el-tag type="danger" v-else-if="applyItem.isPermitted==false">申请未通过审核</el-tag>
    </el-descriptions-item>

    <el-descriptions-item v-if="applyItem.isPermitted==false">
      <template #label>
        <span class="label">理由</span>
      </template>
      {{applyItem.reject}}
    </el-descriptions-item>
    
  </el-descriptions>

  
  
</template>

<script>
export default {
  name: "DeleteApply",
  props:['applyItem'],
  data(){
    return{

    }
  },
  methods:{
    authorUrl(authorId){
      return `/portal?authorId=${authorId}`
    },
    paperUrl(paperId){
      return `/detail?paperId=${paperId}`
    },
    docType(docType){
      if(docType===1){
        return "期刊文献"
      }else if(docType===2){
        return "会议文献"
      }
    }

  },
  computed:{
    typeString(){
      switch (this.applyItem.type){
        case "claim":
          return "认领门户申请";
        case "add":
          return "上传文献申请";
        case "update":
          return "更新文献申请";
        case "delete":
          return "删除文献申请";
      }
    }
  }
}
</script>

<style scoped>
.infoTable{
  font-size: 16px;
  word-break: break-word;
}
.link{
  font-size: 16px;
}
.label{
  word-break: keep-all;
}
</style>